home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 203_01 / yam.h < prev    next >
Text File  |  1980-01-01  |  7KB  |  186 lines

  1. /*
  2. $TITLE ('yam.h: lattice c version')
  3. $DATE (27 OCT 85)
  4. */
  5.  
  6. #include "yamsys.h"        /* installation specific stuff */
  7. #include <stdio.h>
  8.  
  9. /*
  10.  * yam    -Yet Another Modem program
  11.  *    original by Chuck Forsberg 10-18-81
  12.  *    MSDOS conversion Olen Pederson 11/85
  13. */
  14.  
  15. #define TRUE 1
  16. #define FALSE 0
  17. #define ERROR -1
  18. #define OK 0
  19.  
  20. extern char defdisk;            /* default disk */
  21. #define PATHLEN 65                /* maximum path name length */    
  22. #define FLAG int
  23.  
  24.     /* characters will be stripped if received and Ignrx true */
  25. extern char rxnono[15];
  26.  
  27. extern FILE *fin,*fout;
  28. extern int cfast;
  29. extern char checksum;            /* delcared here for speed */
  30. extern unsigned oldcrc;             /* accumulates CRC checksum */
  31. extern int wcj, firstch, errors;
  32. extern FLAG firstsec;            /* first sector, C instead of NAK for crc */
  33.  
  34. #ifndef IOTYPE                    /* may be char* or unsigned for memory mapped i/o */
  35. #define IOTYPE int
  36. #endif
  37.  
  38. #define TABS 8                    /* initial tab expansion */
  39. #define CMDLEN 132
  40. #define LOWWATER 2000            /* low water value causes term to send XOFF */
  41.     /* ascii literals */
  42. #define SOH 1
  43. #define STX 2
  44. #define ETX 3
  45. #define EOT 4
  46. #define ENQ 5
  47. #define ACK 6
  48. #define SO 016
  49. #define SI 017
  50. #define DLE 020
  51. #define NAK 025
  52. #define CAN 030
  53. #define ESC 033
  54.  
  55. #define WANTCRC 0103        /* send C not NAK to get crc not checksum */
  56. #define TIMEOUT (-2)
  57. #define ERRORMAX 5
  58. #define RETRYMAX 5
  59. #define CPMEOF 0x1A
  60.  
  61. #ifndef SECSIZ
  62. #define SECSIZ 128            /* Sector size disk calls */
  63. #endif
  64.  
  65. #define KSIZE 1024            /* block length with k option */
  66.  
  67. /* declare all globally used functions not returning int */
  68. char getcty(), putcty(), *index(), *cisubstr();
  69. unsigned getfree();
  70. FILE *fopen();
  71.  
  72. extern FLAG Quiet;
  73. extern char Ttycol;                    /* column for tab expansion */
  74. extern int tabstop;                    /* current tab expansion */
  75. extern FLAG Rfile;                    /* receiving into a file */
  76. extern FLAG Tfile;                    /* transmitting from a file */
  77. extern FLAG Crcflg;                     /* 1 if using crc, 0 otherwise */
  78. extern FLAG Batch;                    /* Batch (multi-file) xfer */
  79. extern FLAG Creamfile;                /* true means o.k. to blast old file on rx */
  80. extern int blklen;                    /* length of blocks for s and r, usually 128 */
  81. extern unsigned totsecs;            /* accumulator of number of sectors sent/received */
  82. extern unsigned toterrs;            /* total number of errors in xfer(s) */
  83. extern FLAG Txgo;                     /* file sending start/stop (XON/XOFF) */
  84. extern FLAG Dumping;                /* not Squelched ^R */
  85. extern FLAG Pflag;                    /* printing the rx stuff */
  86. #ifdef MYSYSTEM
  87. extern FLAG Cis02;                    /* Special functions for CIS02 access to Compuserve */
  88. #endif
  89. extern FLAG Ctlview;                /* Term function shows control chars as ^char */
  90. extern FLAG View;                    /* View data being transmitted/received if file xfer */
  91. extern FLAG Echo;                    /* Echo modem data back to itself only in chat */
  92. extern FLAG Hdx;                    /* Half Duplex connection -no echo from far end */
  93. extern FLAG Chat;                    /* treat kbd \r as crlf when chatting */
  94. extern FLAG Gototerm;                /* go to term after file xfer */
  95. extern FLAG Exoneof;                /* exit from term() when finished with file */
  96.  
  97. /* Following flags affect data as it is written to file, not captured */
  98. extern FLAG Zeof;        /* Terminate data capture & close file on ^Z */
  99. extern FLAG Squelch;    /* Turn capture on after ^R, off before ^T */
  100. extern char GOchar;        /* normally \n; resumes sending in EOL _ CRWAIT mode */
  101. extern char *Txmoname;    /* asciz string corresponding to Txeoln mode */
  102. extern FLAG Txeoln;        /* what to do at the end of a line */
  103. extern char xon;        /* character for xon */
  104. extern char xoff;        /* character for xoff */
  105.  
  106. #define EOL_NOTHING 0    /* send it all as is */
  107. #define EOL_CR    1        /* send /r only */
  108. #define EOL_NL    2        /* send \n only */
  109. #define EOL_CRWAIT 3    /* send \r then wait for GOchar echo */
  110. #define EOL_CRPROMPT 4    /* send \r then wait for silence. */
  111. #define TX_BINARY 0200    /* don't stop on CPMEOF or whatever **/
  112.  
  113. /* For controls based on time since last RX char mostly */
  114. extern unsigned Timeout;        /* measure of how long since last rxchar */
  115. extern unsigned Tpause;             /* when ++Timeout==Tpause, do something ... */
  116. extern FLAG Xoffflg;            /* !=0 if we sent XOFF to stop the bubble machine */
  117. extern FLAG Waitecho;             /* Wait for echo to stop when sending file */
  118.  
  119. /* If Waitbunch, Wait for Throttle loops each waitnum txchars */
  120. extern FLAG Waitbunch;
  121. extern unsigned Waitnum;        /* do Waitecho each time chars_sent == Waitnum */
  122. extern unsigned Throttle;
  123. extern FLAG Txwait;                 /* used with throttle */
  124. extern unsigned Txtimeout;        /* counted down to 0, then Txwait becomes false */
  125.  
  126. extern unsigned T1pause;        /* for setting 0.1 second timeout for readline */
  127. extern int Lastrx;                /* last char received, for detecting CAN CAN */
  128.  
  129. /*
  130.  * start, end, input, output, printer-output pointers and marker
  131.  * used with data capture
  132.  */
  133. extern char *bufst, *bufend, *bufcq, *bufcdq, *buffcdq, *bufpcdq, *bufmark;
  134. extern unsigned Nfree;                /* Number of characters free in capture buf */
  135. extern unsigned Bufsize;
  136. extern FLAG Wrapped;                /* Buffer insertion pointer has wrapped around */
  137. extern IOTYPE Dport;                /* data port address */
  138. extern unsigned commport;            /* comm port number, related to actual port # */
  139. extern char Mstatus;                 /* contents of modem error register if modem error */
  140. extern unsigned Baudrate;            /* current baudrate */
  141. extern FLAG Originate;                /* Originate mode requested */
  142. extern FLAG Ignrx;                    /* if true, rxnono bits will be thrown awaw */
  143.  
  144.  
  145.     /* default strip parity bits from console kbd */
  146. #ifndef KBMASK
  147. #define KBMASK 0177
  148. #endif
  149.  
  150. extern char cmdbuf[CMDLEN+2], *cp;    /* for commands entered directly (not argv) */
  151. extern char Rname[PATHLEN], Tname[PATHLEN];         /* saved file names */
  152. extern char Phone[80];                /* phone number read in from file */
  153.  
  154. /* declarations for USQ feature */
  155. #define SQMAGIC 0xFF76    /* SQueezed file prefix */
  156. #define NUMVALS 257         /* 256 data values plus SPEOF*/
  157. extern union
  158. {
  159.             FILE *ufbuf;
  160.             char ubuf[KSIZE];
  161.             /* Decoding tree for usq feature */
  162.             struct
  163.             {
  164.                 int children[2];            /* left, right */
  165.             } dnode[NUMVALS - 1];
  166. } Utility;
  167.  
  168.     /* buffer type for file I/O.  used by DOS function find first and
  169.        next. */
  170. struct find_buf
  171. {
  172.     char res[21];
  173.     char attrib;
  174.     unsigned time;
  175.     unsigned date;
  176.     long filesize;
  177.     char pname[13];
  178. };
  179. #define FBSIZ sizeof(struct find_buf)
  180.  
  181. /*
  182.  * Unix is a trademark of Western Electric
  183.  * CP/M, Digital Research
  184.  * MS-DOS, Micro-soft
  185. */
  186.